<HTML><HEAD><TITLE>suspension_to_goal(+Susp, -Goal, -Module)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Obsolete</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>suspension_to_goal(+Susp, -Goal, -Module)</H1>
Succeeds for an unwoken suspension and returns the corresponding Goal
structure and caller module.


<DL>
<DT><EM>Susp</EM></DT>
<DD>A suspension.
</DD>
<DT><EM>Goal</EM></DT>
<DD>A variable or a callable term.
</DD>
<DT><EM>Module</EM></DT>
<DD>A variable or a module.
</DD>
</DL>
<H3>This built-in predicate is obsolete!</H3>
<H2>Description</H2>
   This built-in is used to access the contents of the abstract suspension
   data type.  It is complementary to make_suspension/2 as it returns the
   original goal structure and the module where make_suspension/2 was
   executed.  If applied to an already woken suspension it fails.

<P>
   Note that a suspension is not a standard Prolog data structure and can
   only be manipulated in a restricted way.  In particular, a suspension is
   not a term with functor 'GOAL' or 'WOKEN GOAL' although it is printed
   this way by default.  suspension_to_goal/3 is the only way to access the
   contents of a suspension.

<P>

<H3>Modes and Determinism</H3><UL>
<LI>suspension_to_goal(+, -, -) is semidet
</UL>
<H3>Fail Conditions</H3>
Fails if the suspension is already dead
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>Susp is not instantiated.
<DT><EM>(5) type error </EM>
<DD>Susp is not a suspension.
<DT><EM>(5) type error </EM>
<DD>Goal is neither variable nor a callable term.
<DT><EM>(5) type error </EM>
<DD>Module is neither variable nor atom.
</DL>
<H2>Examples</H2>
<PRE>
[eclipse 1]: make_suspension(writeln(hello),S),
        suspension_to_goal(S, Goal, Module).
S = 'GOAL'(writeln(hello), eclipse)
Goal = writeln(hello)
Module = eclipse
Delayed goals:
        writeln(hello)
yes.
[eclipse 2]: make_suspension(writeln(hello),S),
        call_suspension(S),
        suspension_to_goal(S, Goal, Module).
hello

no (more) solution.


</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/suspensions/get_suspension_data-3.html">get_suspension_data / 3</A>, <A HREF="../../kernel/suspensions/delayed_goals-1.html">delayed_goals / 1</A>, <A HREF="../../kernel/suspensions/kill_suspension-1.html">kill_suspension / 1</A>, <A HREF="../../kernel/suspensions/make_suspension-3.html">make_suspension / 3</A>
</BODY></HTML>
